/*!
 * Header file corresponding to the configuration parser. (cfgparser.cpp)
 * @author Mazzer Yannis, Calingarayar Martial
 */
#ifndef _CFGPARSER_H
#define _CFGPARSER_H

#include <QString>
#include <QMap>
#include <QFile>

/*!
 * Declaration of the ConfigMap structure as a QMap of two QString
 */
typedef QMap<QString,QString> ConfigMap;

/*!
 * This class gathers all the informations related to the user configuration
 * of the application
 */
class Config
{
 public:
/*!
 * Constructor of the Config class. It reads the config file and store each
 * pair
 * in a ConfigMap structure.
 * @param filepath path to the configuration file.
 */
  Config(QString filepath=QString(".qmlrc"));

/*!
 * Public function to access to the pairs stored in the previously fulfilled
 * ConfigMap structure.
 * @param key The configuration keyword associated to the wanted value.
 * @param defval The default value assiocated to the key.
 * @return The found value corresponding to the key.
 */
  QString get(const QString &key,
		  const QString *defval=NULL) const;

 private:
  //const QString & filepath;

  QString str;
  //  QFile *cfgfile;
  ConfigMap m_pairs;

  struct ConfigError
  {
    QString message;
    inline ConfigError(const QString msg)
    {
      message = msg;
    };
  };


};



#endif
